﻿using System;
using System.Collections.Generic;
using System.Text;
using ST.Dal;
using ST.Model;

namespace ST.Bll
{
    public class ArchiveBLL
    {
        private static readonly ArchiveDal dal = new ArchiveDal();
        public ArchiveBLL()
        {
        }
        public Archive getArchive(int archiveID)
        {
            return dal.GetObject(archiveID);
        }
        public void CreateArchive(Archive archive)
        {
            int archiveID = dal.AddArchive(archive);
            archive.ArchiveID = archiveID;       
        }
        public List<Archive> GetList(string where,int topSize)
        {
            return dal.GetList(where, topSize);
        }
        public bool UpdateArchive(Archive archive)
        {
            return dal.UpdateArchive(archive);
        }
        public void AddViewCoutn(Archive archive)
        {
            dal.AddViewCount(archive);
        }
        public void AddCommentCount(Archive archive)
        {
            dal.AddCommentCount(archive);
        }
        /// <summary>
        /// if some category have archives
        /// </summary>
        /// <param name="category"></param>
        /// <returns></returns>
        public bool HaveArchiveByCategory(Category category)
        {
            return dal.HaveArchiveByCategory(category);
        }

    }
}
